/************************************************************************

								Heroes IV
					  Copyright 2000, The 3DO Company

	------------------------------------------------------------------
  						 stationary_combat_object.h

	$Header: /heroes4/stationary_combat_object.h $

	$NoKeywords: $

 ************************************************************************/

#if !defined( STATIONARY_COMBAT_OBJECT_H_INCLUDED )
#define STATIONARY_COMBAT_OBJECT_H_INCLUDED

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "abstract_combat_object.h"
#include "cached_ptr.h"
#include "compound_object_model_ptr.h"
#include "compound_object_ptr.h"
#include "idle_processor.h"
#include "object_segment_ptr.h"
#include "sized_int_types.h"

class t_combat_object_model_cache;
enum  t_obstacle_type;

// -----------------------------------------------------------------------
// t_stationary_combat_object class
// -----------------------------------------------------------------------

class t_stationary_combat_object : public t_abstract_combat_object, public t_idle_processor
{
public:
	// Constructor
	t_stationary_combat_object( t_battlefield& battlefield );
	t_stationary_combat_object( t_battlefield&						battlefield,
								t_combat_object_model_cache const&	model_cache );
	t_stationary_combat_object( t_battlefield&						battlefield,
								t_compound_object*					object );
	virtual ~t_stationary_combat_object();

	// Member functions
	virtual bool            blocks_movement() const;
	virtual bool			can_be_attacked() const;
	bool					can_be_destroyed() const;
	virtual void			draw_shadow_to(
								t_uint32				current_time,
								t_screen_rect const &	source_rect,
								t_abstract_bitmap16 &	dest,
								t_screen_point const &	dest_point ) const;
	virtual void			draw_shadow_to(
								t_uint32				current_time,
								t_abstract_bitmap16 &	dest,
								t_screen_point const &	dest_point ) const;
	virtual void			draw_to(
								t_uint32				current_time,
								t_screen_rect const &	source_rect,
								t_abstract_bitmap16 &	dest,
								t_screen_point const &	dest_point ) const;
	virtual void			draw_to(
								t_uint32				current_time,
								t_abstract_bitmap16 &	dest,
								t_screen_point const &	dest_point ) const;
	virtual t_attackable_object* get_attackable_object();
	virtual t_compound_object*  get_compound_object() const;
	virtual int					get_depth() const;
	virtual int					get_footprint_size() const;
	int							get_frame() const;
	virtual int					get_height() const;
	virtual	t_combat_object_type	get_object_type() const;
	t_obstacle_type					get_obstacle_type() const;
	virtual t_screen_rect			get_rect() const;
	virtual t_screen_rect			get_rect( t_uint32 current_time ) const;
	t_object_segment_ptr			get_segment() const;
	virtual t_screen_rect			get_shadow_rect() const;
	virtual t_screen_rect			get_shadow_rect( t_uint32 current_time ) const;
	virtual bool				hinders_movement() const;
	virtual bool				hit_test( t_uint32				 current_time,
										  t_screen_point const & point ) const;
	void						increment_frame();
	virtual bool				is_animated() const;
	virtual bool				is_permanent() const;
	virtual bool				is_underlay() const;
	virtual bool				needs_redrawing( t_uint32	last_update_time,
												 t_uint32	current_time ) const;
	virtual	bool				obscures_vision() const;
	virtual void				on_idle();
	virtual void                on_placed();
	virtual void				on_removed();
	virtual void				place_during_read( t_battlefield& battlefield );
	virtual bool				read( t_combat_reader& reader );
	void						set_segment( t_object_segment_ptr segment );
	void						set_frame( int arg );
	void						set_object( t_compound_object_ptr object );
	virtual bool				write( t_combat_writer& writer ) const;

private:
	// Data members
	t_battlefield&				m_battlefield;
	int							m_frame;
	t_compound_object_model_ptr m_model;
	std::string					m_model_name;
	t_compound_object_ptr       m_compound_object;
	t_object_segment_ptr	    m_segment;
};

inline t_stationary_combat_object::t_stationary_combat_object( t_battlefield& battlefield )
								 : t_abstract_combat_object( &battlefield ), t_idle_processor(1),
								   m_battlefield( battlefield )
{
}

inline void t_stationary_combat_object::set_object( t_compound_object_ptr object )
{
	m_compound_object = object;
}

inline int t_stationary_combat_object::get_frame() const
{
	return m_frame;
}

inline t_object_segment_ptr t_stationary_combat_object::get_segment() const
{
	return m_segment;
}

inline void t_stationary_combat_object::set_segment( t_object_segment_ptr segment )
{
	m_segment = segment;
}


#endif // !defined( STATIONARY_COMBAT_OBJECT_H_INCLUDED )
